﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using RibbonControler;

namespace HSLTest
{
    public partial class Form1 : Form
    {
        Bitmap HSLbitmap, HSLbitmap2;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            

            int picBoxWidth = panel1.Size.Width;
            int picBoxHeight = panel1.Size.Height;
            int halfWidth = panel1.Size.Width / 2;
            int halfHeight = panel1.Size.Height / 2;

            HSLbitmap = new Bitmap(picBoxWidth, picBoxHeight);
            HSLbitmap2 = new Bitmap(picBoxWidth, picBoxHeight);

            HSLColor color = new HSLColor();
            color.Saturation = 1;

            for (int i = 0; i < 480; i++)
            {
                for (int j = 0; j < 480; j++)
                {
                    color.Hue = j /480.0;
                    color.Luminosity = (double) i / 480.0;
                    HSLbitmap.SetPixel(i, j, (Color)color);
                }
            }

            panel1.BackgroundImage = HSLbitmap;
            
            for (int i = 0; i < 480; i++)
            {
                for (int j = 0; j < 480; j++)
                {
                    Color c = HSLbitmap.GetPixel(i, j);

                    color = c;

                    color.Luminosity *= trackBar1.Value/120.0;

                    HSLbitmap2.SetPixel(i, j, (Color)color);
                }
            }

            panel2.BackgroundImage = HSLbitmap2;
            
        }

        private void trackBar1_ValueChanged(object sender, EventArgs e)
        {
            
        }
    }
}
